﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace ClassLibraryMessageDataType
{
    public enum ErrorCode
    {
        /// <summary>
        /// 通讯故障
        /// </summary>
        commitError = 0,
        /// <summary>
        /// 没有电池
        /// </summary>
        noHaveBat,
        /// <summary>
        /// 短路
        /// </summary>
        catOut,
        /// <summary>
        /// 小于工步设置的最小电流
        /// </summary>
        lessSetMinC,
        /// <summary>
        /// 大于设置的最大电流
        /// </summary>
        moreSetMaxC,
        /// <summary>
        /// 低于工步设置最小电压
        /// </summary>
        lessSetMinV,
        /// <summary>
        /// 超过工步设置最大电压
        /// </summary>
        moreSetMaxV,
        /// <summary>
        /// 双向电源电压过高
        /// </summary>
        doubleDircPowerHV,
        /// <summary>
        /// 双向电源电压过低
        /// </summary>
        doubleDircPowerLV,
        /// <summary>
        /// 电池接触不良
        /// </summary>
        batPoorConnect,
        /// <summary>
        /// 电池反接
        /// </summary>
        batReverse,
        /// <summary>
        /// 搁置电流超限
        /// </summary>
        shekveCH,

    }
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct PointRealTimeData
    {
        public byte positioncode;
        public byte status;
        public byte finishedreason;
        public ushort volate;
        public ushort current;
        public ushort capacity;
        public ushort timepriod;
        public ushort errorcode;
    }

    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct OneProcolRealTimeData_splitarry
    {
        public byte boardcode;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
        public PointRealTimeData []pointrealtimedataArrys;

    }

    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct OneProcolRealTimeData_ALL
    {      
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
        public OneProcolRealTimeData_splitarry[] oneProcolrealtimedata;
    }
}
